package com.xoa.controller.party;

import com.xoa.model.common.SysCode;
import com.xoa.model.party.Execute_Control;
import com.xoa.service.party.ExecuteControlService;
import com.xoa.util.ToJson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Created by crr on 2018/4/20.
 */

/**
 * 布控点
 */
@Controller
@RequestMapping("/executeControl")
public class ExecuteControlController {
    @Autowired
    ExecuteControlService executeControlService;

    /**
     * 郭心雨
     * 2018.4.20
     * 所属社区下拉列表
     * @return
     */
    @ResponseBody
    @RequestMapping("/getAllGridInfo")
    public ToJson<SysCode> getAllGridInfo(String parentNo){
        return executeControlService.getAllGridInfo( parentNo);
    }

    /**
     * 郭心雨
     * 2018-4-20
     * 获取全部的布控点信息
     * @return
     */
    @ResponseBody
    @RequestMapping("/getAllExecute")
    public ToJson<Execute_Control> getAllExecute(String dispa, String gridId , Integer page, Integer pageSize){
        return executeControlService.getAllExecute( dispa,gridId,page,  pageSize);
    }
    /**
     * 郭心雨
     * 2018-4-20
     * 获取全部的布控点信息（分组）
     * @return
     */
    @ResponseBody
    @RequestMapping("/getAllExecuteNew")
    public ToJson<Execute_Control> getAllExecuteNew(@RequestParam(value = "dispa",required = false) String dispa, Integer page, Integer pageSize){
        return executeControlService.getAllExecuteNew( dispa,page,  pageSize);
    }
    /**
     * 郭心雨
     * 2018.4.20
     * 根据id查看详情
     * @param conId
     * @return
     */
    @ResponseBody
    @RequestMapping("/getExecuteById")
    public ToJson getExecuteById(Integer conId){
        return executeControlService.getExecuteById(conId);
    }

    /**
     * 郭心雨
     * 2018.4.20
     * 根据id修改
     * @param executeControl
     */
    @ResponseBody
    @RequestMapping("/updateExecuteById")
    public ToJson updateExecuteById(Execute_Control executeControl){
        return executeControlService.updateExecuteById(executeControl);
    }

    /**
     * 郭心雨
     * 2018.4.20
     * 添加
     * @param executeControl
     */
    @ResponseBody
    @RequestMapping("/addExecute")
    public ToJson addExecute(Execute_Control executeControl){
        return executeControlService.addExecute(executeControl);
    }

    /**
     * 郭心雨
     * 2018.4.20
     * 删除
     * @param conId
     */
    @ResponseBody
    @RequestMapping("/delExecute")
    public ToJson delExecute(Integer conId){
        return executeControlService.delExecute(conId);
    }

}
